package cn.com.bluemoon.daps.standard.api;

import cn.com.bluemoon.daps.common.constant.ServiceNameConstants.DapsApiStandard;
import cn.com.bluemoon.daps.common.domain.ResultBean;
import cn.com.bluemoon.daps.standard.api.factory.RemoteStandardDataTypeFactory;
import cn.com.bluemoon.daps.standard.entity.DapStandardDataType;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 * @author Jarod.Kong
 * @date 2021/3/24 16:15
 */
@FeignClient(value = DapsApiStandard.SERVICE, fallbackFactory = RemoteStandardDataTypeFactory.class)
@RequestMapping(DapsApiStandard.BASE_URI + DapsApiStandard.API_SYS_STD_DATA_TYPE)
@ApiIgnore
public interface RemoteStandardDataTypeService {

    /**
     * 模型id获取数据库对应的字段类型
     * @param dbType  数据库类型，1 mysql, 2 pgsql, 3 hive
     * @return 查询字段能使用的数据类型
     */
    @GetMapping("/dataType")
    public ResultBean<List<DapStandardDataType>> getDataTypeByDbType(@RequestParam("dbType") @ApiParam("数据库类型，1 mysql, 2 pgsql, 3 hive") Integer dbType);

    /**
     * 获取数据库字段类型基础数据
     *
     * @return 获取数据库字段类型基础数据
     */
    @GetMapping("/dataTypes")
    public ResultBean<List<DapStandardDataType>> listDataTypes();

}
